import React, { memo } from 'react';
import { IM } from '@/molecules';
import styles from './index.less';

// 面谈总结(皆可展示)/面谈详情(5=已完成)
const TalkIM = ({ data = {}, conclusionImTip = '已发起 IM 讨论，系统自动为招聘发起人、负责人、本轮面试官创建讨论群', isConclusion, arrangeId = '' }) => {
    const { interviewArrangeVO = {} } = data;
    const { imGroupId, imTitle, id, interviewStatus } = interviewArrangeVO;
    const isEdit = id === arrangeId;
    return <div className={styles.conclusionImWrap}>
        {
            (imGroupId && [5, '5'].includes(interviewStatus)) || (imGroupId && isConclusion) ?
                <>
                    <div className={styles.conclusionRoundTitle}>{imTitle}</div>
                    {
                        isEdit && (
                            <div className={styles.conclusionImTip}>
                                { conclusionImTip }
                            </div>)
                    }
                    <IM groupId={imGroupId} readOnly={!isEdit} />
                </> : null
        }
    </div>;
};

export default memo(TalkIM)
